home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM09_A.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  6KB  |  108 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM09_A.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   restore_context                                         ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function restores the mapping context of the       ;
  7. ;                     LIM 3.X page frame.  This function restores the mapping ;
  8. ;                     context of the four 16K pages defined by the page frame ;
  9. ;                     after a call to save_context.  (The caller MUST have    ;
  10. ;                     previously allocated a handle and saved a context in    ;
  11. ;                     order to restore this context from within EMM.          ;
  12. ;                                                                             ;
  13. ;                     restore_context restores the page mapping hardware      ;
  14. ;                     contents on the expanded memory boards for a particular ;
  15. ;                     EMM handle.  This function lets your program restore    ;
  16. ;                     the contents of the mapping hardware its EMM handle     ;
  17. ;                     saved. (See save_context for the save operation.)       ;
  18. ;                                                                             ;
  19. ;                     If you're writing a resident program, an interrupt      ;
  20. ;                     service routine, or a device driver that uses expanded  ;
  21. ;                     memory, you must restore the mapping hardware to the    ;
  22. ;                     state it was in before your program took over.  You     ;
  23. ;                     must save this state because application software using ;
  24. ;                     expanded memory might have been running when your       ;
  25. ;                     program was invoked.                                    ;
  26. ;                                                                             ;
  27. ;                     The restore_context function requires the EMM handle    ;
  28. ;                     that was assigned to your resident program, interrupt   ;
  29. ;                     service routine, or device driver at the time it was    ;
  30. ;                     initialized.  This is not the EMM handle that the       ;
  31. ;                     application software was using when your software       ;
  32. ;                     interrupted it.                                         ;
  33. ;                                                                             ;
  34. ;                     The restore_context function restores the state of the  ;
  35. ;                     map hardware for only the 64K-byte page frame defined   ;
  36. ;                     in versions 3.x of this specification.  Since all       ;
  37. ;                     applications written to LIM versions 3.x require        ;
  38. ;                     restoring the map hardware state of only this 64K-byte  ;
  39. ;                     page frame, restoring the entire mapping state for a    ;
  40. ;                     large number of mappable pages would be inefficient use ;
  41. ;                     of memory.  Applications that use a mappable memory     ;
  42. ;                     region outside the LIM 3.x page frame should use the    ;
  43. ;                     get_context, set_context, get_set_context,              ;
  44. ;                     get_partial_context, and set_partial_context functions  ;
  45. ;                     to save and restore the state of the map hardware.      ;
  46. ;                                                                             ;
  47. ;           PASSED:   handle:                                                 ;
  48. ;                        is the EMM handle assigned to the interrupt service  ;
  49. ;                        routine that's servicing the software or hardware    ;
  50. ;                        interrupt.  The interrupt service routine needs to   ;
  51. ;                        restore the state of the page mapping hardware.      ;
  52. ;                                                                             ;
  53. ;         RETURNED:   status:                                                 ;
  54. ;                        is the status EMM returns from the call.  All other  ;
  55. ;                        returned results are valid only if the status        ;
  56. ;                        returned is zero.  Otherwise they are undefined.     ;
  57. ;                                                                             ;
  58. ; C USE CONVENTION:   unsigned int status;                                    ;
  59. ;                     unsigned int handle;                                    ;
  60. ;                                                                             ;
  61. ;                     status = restore_context (handle);                      ;
  62. ;-----------------------------------------------------------------------------;
  63. .XLIST
  64. PAGE    60,132
  65.  
  66. IFDEF SMALL
  67.    .MODEL SMALL, C
  68. ENDIF
  69. IFDEF MEDIUM
  70.    .MODEL MEDIUM, C
  71. ENDIF
  72. IFDEF LARGE
  73.    .MODEL LARGE, C
  74. ENDIF
  75. IFDEF COMPACT
  76.    .MODEL COMPACT, C
  77. ENDIF
  78. IFDEF HUGE
  79.    .MODEL HUGE, C
  80. ENDIF
  81.  
  82. INCLUDE emmlib.equ
  83. INCLUDE emmlib.str
  84. INCLUDE emmlib.mac
  85. .LIST
  86. .CODE
  87.  
  88. restore_context        PROC                                                  \
  89.             handle:WORD
  90.  
  91.     ;---------------------------------------------------------------------;
  92.     ;   do;                                                               ;
  93.     ;   .   restore the LIM 3.X mapping context saved within EMM;         ;
  94.     ;---------------------------------------------------------------------;
  95.     MOVE        AH, restore_page_map_fcn
  96.     MOVE        DX, handle
  97.     INT         EMM_int
  98.  
  99.     ;---------------------------------------------------------------------;
  100.     ;   .   return (EMM status);                                          ;
  101.     ;   end;                                                              ;
  102.     ;---------------------------------------------------------------------;
  103.     RET_EMM_STAT    AH
  104.  
  105. restore_context        ENDP
  106.  
  107. END
  108.